1. 图像信息获取123456789101112131415161718192021222324// 获取图像信息#include <iostream>#include <opencv2/opencv.hpp>using namespace cv;using namespace std;int main(){ Mat img = imread("/home/v/home.png"); if(img.empty()){ cout<<"Error: Could not load image."<<endl; return -1; } imshow("img",img); cout<<"img row: "<<img.rows<<endl; cout<<"img col: "<<img.cols<<endl; cout<<"img ch: "<<img.channels()<<endl; waitKey(0); return 0;} 2. 图像ROI12345678910111213141516171819202122232425262728// 获取图像信息#include <iostream>#include <opencv2/opencv.hpp>using namespace cv;using namespace std;int main(){ Mat img = imread("/home/v/home.png"); if(img.empty()){ cout<<"Error: Could not load image."<<endl; return -1; } imshow("img",img); // 图像信息 cout<<"img row: "<<img.rows<<endl; cout<<"img col: "<<img.cols<<endl; cout<<"img ch: "<<img.channels()<<endl; // 图像roi Mat imageROI(img, Rect(100,100,200,150)); imshow("imageROI",imageROI); waitKey(0); return 0;}